<!DOCTYPE html>
<html>
<head>
<base href="/">
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>电子发票管理平台登录</title>
<meta name="author" content="DeathGhost">
<link rel="stylesheet" type="text/css" href="/admin/html/module/baicheng/jiaofei_list/style.css"
	tppabs="/css/style.css">
	<script type="text/javascript" src="/admin/js-css/js/jquery-1.7.2.min.js"></script>
	<script type="text/javascript" src="/admin/js-css/js/mx1.0.js?v=1.1"></script>

<style>
body {
	height: 100%;
	background: #16a085;
	overflow: hidden;
}

canvas {
	z-index: -1;
	position: absolute;
}
</style>
<script src="/login_css/verificationNumbers.js" tppabs="/js/verificationNumbers.js"></script>
<script src="/login_css/Particleground.js" tppabs="/js/Particleground.js"></script>

</head>
<body>
	<canvas class="pg-canvas" width="1680" height="881"></canvas>
	<dl class="admin_login">
		<dt>
			<strong>电子发票管理平台</strong> <em>Management System</em>
		</dt>
		<dd class="user_icon">
			<input type="text" lable="账号" placeholder="账号" class="login_txtbx" id="username"  name="YHM" submit="login" requir=true >
		</dd>
		<dd class="pwd_icon">
			<input type="password" lable="密码" placeholder="密码" class="login_txtbx" id="password" name="MM" submit="login" requir=true >
		</dd>
		
		<dd>
			<input type="button" value="立即登陆" class="submit_btn" onclick="f_login()">
		</dd>
		<dd>
			<p>© 2015-2017   版权所有</p>
		</dd>
	</dl>




<script>

//给登陆添加回车事件
$(window).keyup(function(e){
	if(e.keyCode == 13){
		f_login();
	}
});


function f_login(){
	var data = {login_name: $("#username").val(),
		password: $("#password").val()};
	$.ajax({
		type: "POST",
		url: "/admin/api/UserController/login",
		contentType: "application/json",
		dataType: "json",
		data: JSON.stringify(data),
		success: function (res) {
			console.log(res);
			if (res.code == 0) {
				alert(res.msg);
			} else {
				let token = res.data.token;
				localStorage.setItem("token", token);
				localStorage.setItem("user", JSON.stringify(res.data));
				document.location.href = "kaipiao.html";
			}
		}
	});

}
</script>
</body>
</html>